package com.mineoj.model.vo;

import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mineoj.model.entity.Competition;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 比赛视图
 *
 
 */
@Data
public class CompetitionVO implements Serializable {

    /**
     * id
     */
    private Long id;

    /**
     * 标题
     */
    private String title;

    /**
     * 内容
     */
    private String content;

    /**
     * 参加数
     */
    private Integer joinNum;

    /**
     * 题目数
     */
    private Integer questionNum;
    

    /**
     * 开始时间
     */
    private Date beginTime;

    /**
     * 结束时间
     */
    private Date endTime;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 是否删除
     */
    private Integer isDelete;
    /**
     * 创建人信息
     */
    private UserVO user;

    /**
     * 是否已参加
     */
    private Boolean hasJoin;
    

    /**
     * 包装类转对象
     *
     * @param competitionVO
     * @return
     */
    public static Competition voToObj(CompetitionVO competitionVO) {
        if (competitionVO == null) {
            return null;
        }
        Competition competition = new Competition();
        BeanUtils.copyProperties(competitionVO, competition);
        return competition;
    }

    /**
     * 对象转包装类
     *
     * @param competition
     * @return
     */
    public static CompetitionVO objToVo(Competition competition) {
        if (competition == null) {
            return null;
        }
        CompetitionVO competitionVO = new CompetitionVO();
        BeanUtils.copyProperties(competition, competitionVO);
        return competitionVO;
    }
}
